package com.xinsoft.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinsoft.common.CountBean;
import com.xinsoft.entity.dto.ScmPurchasePageParam;
import com.xinsoft.entity.dto.ScmPurchasePlanPageParam;
import com.xinsoft.entity.po.ScmPurchasePlan;
import com.xinsoft.entity.po.ScmPurchasePlanItem;
import com.xinsoft.entity.vo.ScmPurchasePlanPageVo;
import com.xinsoft.entity.vo.ScmPurchasePlanVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @author 13370
* @description 针对表【scm_purchase_plan_item(采购计划明细)】的数据库操作Mapper
* @createDate 2023-07-04 14:35:53
* @Entity com.xinsoft.entity.po.ScmPurchasePlanItem
*/
public interface ScmPurchasePlanMapper extends BaseMapper<ScmPurchasePlan> {

    IPage<ScmPurchasePlanPageVo> findListByParam(Page<ScmPurchasePlanPageVo> page, @Param("param") ScmPurchasePlanPageParam scmPurchasePlanPageParam);

    List<ScmPurchasePlanPageVo> findListByParam(@Param("param") ScmPurchasePlanPageParam scmPurchasePageParam);

    ScmPurchasePlanVo getScmPurchasePlan(@Param("id") Integer id);

    /**
     * 获取采购计划中已用的源单物料数量
     * @param sourceIds  源单ids
     * @param sourceType 源单类型
     */
    List<CountBean> getUsedCountOfPurchasePlan(@Param("sourceIds") List<Integer> sourceIds, @Param("sourceType") Integer sourceType);
}




